
public class Package {
	private long uid;
	private Node nsrc; //the source node;
	private Node dst; //the destination node;
	private long birthTime; //the cc when the Packet is generated;
	private long lastTransition;
	private long flitSize;
	private long flitCount;
	
	public Package (Node n1, Node n2, long flitSize){
		uid=DataStore.getInstance().getNewPackageId();
		nsrc=n1;
		dst=n2;
		this.flitSize=flitSize;
		this.flitCount=flitSize; //initialy we have not sent any flit on the VC
		birthTime=Timer.getInstance().getTime();		
	}
	
	public void updateTransition(){
		lastTransition=Timer.getInstance().getTime();
	}
	
	public Node getDestNode(){
		return dst;
	}
	public long sendFlit(){
		flitCount--; //countdown style
		if (flitCount==0){
			flitCount=flitSize;
			// !!! send the packacge to the next node
		}
		return flitCount;
	}
	
	public String toString(){
		return uid+":"+nsrc.getId()+"->"+dst.getId();
	}
	
	


}
